<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="/backs/lib/html5shiv.js"></script>
    <script type="text/javascript" src="/backs/lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="/backs/static/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="/backs/static/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="/backs/lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="/backs/static/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css" href="/backs/static/h-ui.admin/css/style.css"/>
    <!--[if IE 6]>
    <script type="text/javascript" src="/backs/lib/DD_belatedPNG_0.0.8a-min.js"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>新增图片</title>
    <link href="/backs/lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 订单管理 <span
            class="c-gray en">&gt;</span> 合并订单 <a class="btn btn-success radius r"
                                                  style="line-height:1.6em;margin-top:3px"
                                                  href="javascript:location.replace(location.href);" title="刷新"><i
                class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
    <div class="text-c">
        主订单：
        <input name="to_order_sn" type="text" class="input-text Wdate" id="to_order_sn">
        <select name="to_list" id="to_list" class="input-text Wdate"
                onchange="if (this.value != '') document.getElementById('to_order_sn').value = this.value;">
            <option value="">请选择...</option>
            <?php foreach ($data as $v) { if ($v['order_status']==1){?>
                <option value="<?= $v['order_number'] ?>"><?= $v['order_number'] ?>&nbsp;&nbsp;&nbsp; [@已发货]</option>
            <?php } }?>
            <?php foreach ($data as $v) { if ($v['order_status']==2){?>
                <option value="<?= $v['order_number'] ?>"><?= $v['order_number'] ?>&nbsp;&nbsp;&nbsp; [@待付款]</option>
            <?php } }?>
            <?php foreach ($data as $v) { if ($v['order_status']==3){?>
                <option value="<?= $v['order_number'] ?>"><?= $v['order_number'] ?>&nbsp;&nbsp;&nbsp; [@待发货]</option>
            <?php }} ?>
        </select>
    </div>
    <div class="text-c">
        从订单：
        <input name="from_order_sn" class="input-text Wdate" type="text" id="from_order_sn">
        <select name="from_list" class="input-text Wdate"
                onchange="if (this.value != '') document.getElementById('from_order_sn').value = this.value;">
            <option value="">请选择...</option>
            <?php foreach ($data as $v) { if ($v['order_status']==1){?>
                <option value="<?= $v['order_number'] ?>"><?= $v['order_number'] ?>&nbsp;&nbsp;&nbsp; [@已发货]</option>
            <?php } }?>
            <?php foreach ($data as $v) { if ($v['order_status']==2){?>
                <option value="<?= $v['order_number'] ?>"><?= $v['order_number'] ?>&nbsp;&nbsp;&nbsp; [@待付款]</option>
            <?php } }?>
            <?php foreach ($data as $v) { if ($v['order_status']==3){?>
                <option value="<?= $v['order_number'] ?>"><?= $v['order_number'] ?>&nbsp;&nbsp;&nbsp; [@待发货]</option>
            <?php }} ?>
        </select>
        <span class="notice-span" style="display:block"
              id="noticeOrderSn">当两个订单不一致时，合并后的订单信息（如：支付方式、配送方式等）以主订单为准。</span>
    </div>
    <div class="text-c">
        <input name="merge" type="button" id="merge" value="合并" class="btn btn-success button" onclick="merge()">
    </div>
</div>


<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/backs/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/backs/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/backs/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="/backs/static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer /作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/backs/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="/backs/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="/backs/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="/backs/lib/webuploader/0.1.5/webuploader.min.js"></script>
<script type="text/javascript">
    function merge() {
        var zid = $('#to_order_sn').val();
        var cid = $('#from_order_sn').val();
        if (zid != '' && cid != '') {
            if (zid === cid) {
                layer.msg('订单号不能一致!', {icon: 1, time: 1000});
            } else {
                layer.confirm('是否合并！', function (index) {
                    $.post('/admin/ordermerge', {zid: zid, cid: cid}, function (res) {
                        if (res == 1) {
                            location.replace(location.href);
                            layer.msg('合并成功!', {icon: 1, time: 1000});
                        }
                        if (res == 2) {
                            layer.msg('合并失败!', {icon: 1, time: 1000});
                        }
                        if (res == 3) {
                            layer.msg('状态不一致!', {icon: 1, time: 1000});
                        }
                    });
                })
            }
        } else {
            layer.msg('不能为空!', {icon: 1, time: 1000});
        }
    }
</script>
</body>
</html>